

clear all
set more off 
set matsize 11000
pause on
set scheme s1color
graph set window fontface "Palatino"



capture confirm file "Main_Results/"
if _rc mkdir "Main_Results/"



import excel "Data/deaths.xlsx", sheet("Sheet1") firstrow


		
drop if Name=="2019-20 COVID-19 Pandemic"
replace Name="Italian plague" if Name=="Italian plague of 1629–1631"
replace Name = subinstr(Name," outbreak","",.)

gen Date = " (" + string(StartYear) + "–" + string(EndYear) + ")"
replace Date = " (" + string(StartYear) + ")" if StartYear==EndYear

gen NameDate = Name + Date
gen cat = _n
order cat
labmask cat, values(NameDate)

gen hi = max(LoCT,HiCT,Lo1,Hi1,Lo2,Hi2)
gen lo = min(LoCT,HiCT,Lo1,Hi1,Lo2,Hi2)

drop if _n>=20
	
twoway ///
	pccapsym cat lo cat hi , ms(i) lc(purple*0.5) || ///
	scatter  cat AvCT , mc(red..) msy(O)     || /// 
	scatter  cat LoCT , mc(red..) msy(Oh)    || /// 
	scatter  cat HiCT , mc(red..) msy(Oh)    || /// 
	scatter  cat RescaledCT , mc(green..) msy(Dh)    || /// 
	scatter  cat Lo1  , mc(blue..) msy(X) mlab(S1) mlabp(5)  mlabcol(blue..)  || ///
	scatter  cat Hi1  , mc(blue..) msy(X) mlab(S1) mlabp(5)  mlabcol(blue..)  || /// 
	scatter  cat Lo2  , mc(blue..) msy(X) mlab(S2) mlabp(5)  mlabcol(blue..)  || ///
	scatter  cat Hi2  , mc(blue..) msy(X) mlab(S2) mlabp(5)  mlabcol(blue..)  || ///
	pcarrowi 21.5 2471.801 20 2471.801 , color(orange) ///
	xsize(6) ysize(3) scale(0.8) xsc(log) ysc(r(1 19)) ///
		xlab(100 1000 10000 100000 1000000) ysc(reverse) ylab(1(1)19,valuelabel angle(horizontal)) ///
		xtit("Deaths (thousands)") ytit("") ///
		legend(ring(0) pos(5) col(1) region(color(none)) ///
		order( 	1 "Range" ///
				2 "Cirillo-Taleb central estimate" ///
				3 "Cirillo-Taleb high-low range" ///
				6 "Other estimates and sources"  ///
				5 "Cirillo-Taleb central estimate" "(rescaled to 2020 world population)" ///
				10 "COVID-19 global deaths reach 2,471,801" "on February 22, 2021 (JHU data)" /// 
				))
	
gr save   Main_Results/Fig1.gph    , replace	
gr export Main_Results/Fig1.pdf , replace	
	

	
	
